<?php

application::IsAuthenticationRequired(true);

?>
<?php
	
	application::addHeaderCSS("application/template/default/dhtmlx/dhtmlxLayout/codebase/dhtmlxlayout.css");
	application::addHeaderCSS("application/template/default/dhtmlx/dhtmlxLayout/codebase/skins/dhtmlxlayout_dhx_skyblue.css");
	
	application::addHeaderJS("application/template/default/dhtmlx/dhtmlxLayout/codebase/dhtmlxcommon.js");
	application::addHeaderJS("application/template/default/dhtmlx/dhtmlxLayout/codebase/dhtmlxlayout.js");
	application::addHeaderJS("application/template/default/dhtmlx/dhtmlxLayout/codebase/dhtmlxcontainer.js");
	
	
	application::addHeaderCSS("application/template/default/dhtmlx/dhtmlxToolbar/codebase/skins/dhtmlxtoolbar_dhx_skyblue.css");
	application::addHeaderJS("application/template/default/dhtmlx/dhtmlxToolbar/codebase/dhtmlxtoolbar.js");
	
?>

<style>
		html, body {
			width: 100%;
			height: 100%;
			margin: 0px;
			padding: 0px;
			overflow: hidden;
		}
	</style>
	
<div id="parentId" style="width: 100%;height: 100%;	margin: 0px;padding: 0px; overflow: hidden;"></div>

<div id="content" style="position: relative; top: 20px; left: 20px; width: 600px; height: 400px; aborder: #B5CDE4 1px solid;">

		Bem Vindo.
		
		
		
		<div id="toolbarObj"></div>
		<div style="margin-top: 20px;">
		<table cellspacing="0" cellpadding="2" border="0">
		    <tr>
		        <td style="padding-right: 5px;">
		            Position
		        </td>
		        <td>
		            <input id="txt1" type="text" value="1" style="width: 30px;">
		        </td>
		    </tr>
		    <tr>
		        <td style="padding-right: 5px;">
		            Text
		        </td>
		        <td>
		            <input id="txt2" type="text" value="Button">
		        </td>
		    </tr>
		    <tr>
		        <td style="padding-right: 5px;">
		            Image
		        </td>
		        <td>
		            <table cellspacing="0" cellpadding="2" border="0">
		                <tr>
		                    <td><img id="new"     onclick="changeImage(this);" src="../common/imgs/new.gif"     style="border: #707070 1px solid; width: 18px; height: 18px; cursor: pointer;"></td>
		                    <td><img id="open"    onclick="changeImage(this);" src="../common/imgs/open.gif"    style="border: #E0E0E0 1px solid; width: 18px; height: 18px; cursor: pointer;"></td>
		                    <td><img id="save"    onclick="changeImage(this);" src="../common/imgs/save.gif"    style="border: #E0E0E0 1px solid; width: 18px; height: 18px; cursor: pointer;"></td>
		                    <td><img id="save_as" onclick="changeImage(this);" src="../common/imgs/save_as.gif" style="border: #E0E0E0 1px solid; width: 18px; height: 18px; cursor: pointer;"></td>
		                    <td><img id="undo"    onclick="changeImage(this);" src="../common/imgs/undo.gif"    style="border: #E0E0E0 1px solid; width: 18px; height: 18px; cursor: pointer;"></td>
		                    <td><img id="redo"    onclick="changeImage(this);" src="../common/imgs/redo.gif"    style="border: #E0E0E0 1px solid; width: 18px; height: 18px; cursor: pointer;"></td>
		                    <td><img id="cut"     onclick="changeImage(this);" src="../common/imgs/cut.gif"     style="border: #E0E0E0 1px solid; width: 18px; height: 18px; cursor: pointer;"></td>
		                    <td><img id="copy"    onclick="changeImage(this);" src="../common/imgs/copy.gif"    style="border: #E0E0E0 1px solid; width: 18px; height: 18px; cursor: pointer;"></td>
		                    <td><img id="paste"   onclick="changeImage(this);" src="../common/imgs/paste.gif"   style="border: #E0E0E0 1px solid; width: 18px; height: 18px; cursor: pointer;"></td>
		                    <td><img id="print"   onclick="changeImage(this);" src="../common/imgs/print.gif"   style="border: #E0E0E0 1px solid; width: 18px; height: 18px; cursor: pointer;"></td>
		                </tr>
		            </table>
		        </td>
		    </tr>
		    <tr>
		        <td style="padding-right: 5px;">
		            Add?
		        </td>
		        <td>
		            <input type="button" value="Add" onclick="add();">
		        </td>
		    </tr>
		</table>
		<table cellspacing="0" cellpadding="2" border="0" style="margin-top: 10px;">
		    <tr>
		        <td style="padding-right: 5px;"><select id="sel"></select></td>
		        <td><input type="button" value="Remove" onclick="remove();"></td>
		    </tr>
		</table>
		</div>
		

</div>







<script>
var sel = document.getElementById("sel");
var toolbar = new dhtmlXToolbarObject("toolbarObj");

#toolbar.setIconsPath("../common/imgs/");
#toolbar.loadXML("../common/dhxtoolbar_button.xml?etc=" + new Date().getTime(), updateList);

var img = "new";
var lastImg = document.getElementById("new");
function changeImage(imgObj) {
    img = imgObj.id;
    imgObj.style.border = "#707070 1px solid";
    lastImg.style.border = "#E0E0E0 1px solid";
    lastImg = imgObj;
}
function add() {
    var id = String(new Date().getTime());
    var pos = Number(document.getElementById("txt1").value);
    var text = String(document.getElementById("txt2").value);
    toolbar.addButton(id, pos, (text.length > 0 ? text: null), img + ".gif", null);
    updateList();
}
function getId() {
    var id = sel.options[sel.selectedIndex].value;
    return id;
}
function remove() {
    if (sel.options.length == 0) {
        return;
    }
    toolbar.removeItem(getId());
    updateList();
}
function updateList() {
    sel.options.length = 0;
    toolbar.forEachItem(function(itemId) {
        if (toolbar.getType(itemId) == "button") {
            sel.options.add(new Option("'" + itemId + "' (" + toolbar.getItemText(itemId) + ")", itemId));
        }
    });
}
</script>


<script>
var dhxLayout;
function doOnLoad() {
    dhxLayout = new dhtmlXLayoutObject("parentId", "1C");
    dhxLayout.cells("a").setText("Bem Vindo");
    dhxLayout.cells("a").attachObject("content");
}
doOnLoad();
</script>

